# -*- coding: utf-8 -*-

import os
import shutil
import glob
from distutils.core import setup
from distutils.command.install import install

def generate_rcc():
    os.system("pyrcc4 -o PyDilbert/dilbert_rc.py PyDilbert/dilbert.qrc")

class Install(install):
    def run(self):
        generate_rcc()
        install.run(self)
        self.installi18n()

    def installi18n(self):
        os.system("lrelease-qt4 i18n/*_*.ts")
        for name in ["tr_TR"]:
            destpath = os.path.join("/usr/share/pydilbert/")
            if not os.path.exists(destpath):
                os.makedirs(destpath)
            shutil.copy("i18n/pydilbert-%s.qm" % name, destpath)

setup(name="pydilbert",
      version= "1.0_rc1",
      description="Fetch Dilbert comic",
      license="GNU GPL v2",
      author="İsmail Dönmez",
      author_email="ismail@pardus.org.tr",
      url="https://pydilbert.googlecode.com/svn",
      package_dir = {'': ''},
      packages = ['PyDilbert'],
      scripts = ['pydilbert'],
      cmdclass = {'install' : Install}
      )
